import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceMaintenanceVO, DeviceMaintenanceForm, DeviceMaintenanceQuery } from '@/api/device/deviceMaintenance/types';

/**
 * 查询设备维护列表
 * @param query
 * @returns {*}
 */

export const listDeviceMaintenance = (query?: DeviceMaintenanceQuery): AxiosPromise<DeviceMaintenanceVO[]> => {
  return request({
    url: '/system/deviceMaintenance/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备维护详细
 * @param id
 */
export const getDeviceMaintenance = (id: string | number): AxiosPromise<DeviceMaintenanceVO> => {
  return request({
    url: '/system/deviceMaintenance/' + id,
    method: 'get'
  });
};

/**
 * 新增设备维护
 * @param data
 */
export const addDeviceMaintenance = (data: DeviceMaintenanceForm) => {
  return request({
    url: '/system/deviceMaintenance',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备维护
 * @param data
 */
export const updateDeviceMaintenance = (data: DeviceMaintenanceForm) => {
  return request({
    url: '/system/deviceMaintenance',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备维护
 * @param id
 */
export const delDeviceMaintenance = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/deviceMaintenance/' + id,
    method: 'delete'
  });
};
